MTG Digital offer a range of services, that help you on your digital journey. If you have a digital project coming up, or your wondering how a service may benefit your business, see below for more information
function send_form_submission_to_capsule($lead){
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.capsulecrm.com/api/v2/parties',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>json_encode([
'party' => [
'type' => 'person',
'about' => 'Their Guess Was - ' . $lead['guess'] . '
Their Business Was - ' . $lead['business'],
'title' => '',
'firstName' => $lead['first'],
'lastName' => $lead['last'],
'jobTitle' => $lead['job_title'],
'organisation' => null,
'owner' => [
'id' => 575317
],
'emailAddresses' => [
[
'type' => 'Work',
'address' => $lead['email']
]
],
'phoneNumbers' => [
[
'type' => null,
'number' => $lead['mobile']
]
],
'tags' => [
[
'name' => 'lcre2023'
]
]
]
]),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer js91ZXymDi/6Y7YaSv5yViK5Tapbic+qPwtZOdKOtjeECpqWaAIfpuqoFz86OsXn'
),
));
$response = curl_exec($curl);
curl_close($curl);
}
function modify_formidable_email($recipients, $values, $form_id, $args) {
if($form_id == 3 ){
$inputted_fields = $args['entry']->metas;
$lead = [
'business'=> $inputted_fields[22],
'first'=> $inputted_fields[27],
'last'=> $inputted_fields[28],
'job_title'=> $inputted_fields[23],
'email'=> $inputted_fields[20],
'mobile'=> $inputted_fields[24],
'direct'=> isset($inputted_fields[25]) ? $inputted_fields[25] : null,
'guess'=> $inputted_fields[29]
];
send_form_submission_to_capsule($lead);
}
return $recipients;
}
add_filter('frm_to_email', 'modify_formidable_email', 10, 4);
function remove_content_editor_support_on_form_events() {
if (is_page_template('template-event-form.php')) {
remove_post_type_support('page', 'editor');
}
}
add_action('admin_init', 'remove_content_editor_support_on_form_events');